package com.f2prateek.rx.preferences2;


import io.reactivex.annotations.NonNull;
import ohos.data.preferences.Preferences;

final class StringAdapter implements RealPreference.Adapter<String> {
    static final StringAdapter INSTANCE = new StringAdapter();

    @NonNull
    @Override
    public String get(@NonNull String key, @NonNull Preferences preferences,
                      @NonNull String defaultValue) {
        //noinspection ConstantConditions
        return preferences.getString(key, defaultValue);
    }

    @Override
    public void set(@NonNull String key, @NonNull String value,
                    @NonNull Preferences editor) {
        editor.putString(key, value);
    }
}
